package com.opc.utils;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author SEG
 */
public class DateUtils {
    public static List<String> getDayList(Date startTime, Date endTime, String format) {
        List<String> dayList = new ArrayList<>();
        long num = DateUtil.betweenDay(startTime, endTime, false);
        DateTime start = DateUtil.beginOfMonth(startTime);
        for (int i = 0; i <= num; i++) {
            dayList.add(DateUtil.format(DateUtil.offsetDay(start, i), format));
        }
        return dayList;
    }
}
